
#ifndef STORAGEAO_ADAPTOR_H
#define STORAGEAO_ADAPTOR_H

#include <stdint.h>
#include "c2cplatform/library/basic/singleton_t.h"
#include "libc2c/byte_stream.h"
#include "app_platform/help_macros.h"
#include "app_platform/intf_svc.h"
#include "intf_service.h"
#include "storageao.h"

using namespace erp::storage::ao;

/**
 * @class CStorageAoService
 * @brief Service与Container接口类
 */
class CStorageAoService : public ISvc
{
public:
    CStorageAoService(uint32_t dwcmdId);
	
public:
    virtual int Execute(CCmdObj& oCmd);  
    virtual void Reset();
    virtual void getCmdIdRange(uint32_t& dwcmdIdBegin, uint32_t& dwcmdIdEnd) const;

private:
		int AddDisassembleBill(CCmdObj& oCmd);
		int AddLoseBillOrOverFlowBill(CCmdObj& oCmd);
		int AddStock(CCmdObj& oCmd);
		int AddStockCheck(CCmdObj& oCmd);
		int DeleteDisassembleBill(CCmdObj& oCmd);
		int DeleteLoseBillOrOverFlowBill(CCmdObj& oCmd);
		int DeleteStock(CCmdObj& oCmd);
		int DeleteStockCheck(CCmdObj& oCmd);
		int GetDisassembleBillBySysNos(CCmdObj& oCmd);
		int GetDisassembleBillList(CCmdObj& oCmd);
		int GetLoseBillOrOverFlowBillBySysNos(CCmdObj& oCmd);
		int GetLoseBillOrOverFlowBillList(CCmdObj& oCmd);
		int GetStockBranch_RelBySysNo(CCmdObj& oCmd);
		int GetStockBySysNos(CCmdObj& oCmd);
		int GetStockCheckBySysNos(CCmdObj& oCmd);
		int GetStockCheckList(CCmdObj& oCmd);
		int GetStockList(CCmdObj& oCmd);
		int ModifyStockBranch_Rel(CCmdObj& oCmd);
		int UpdataDisassembleBill(CCmdObj& oCmd);
		int UpdataLoseBillOrOverFlowBill(CCmdObj& oCmd);
		int UpdataStockCheck(CCmdObj& oCmd);
		int UpdateStock(CCmdObj& oCmd);
private:
	uint32_t m_dwcmdId;
    CStorageAo* m_pSvc;
};

/**
 * @class CStorageAoSvcFactory
 * @brief 生成Service的工厂
 */
class CStorageAoSvcFactory : public ISvcFactory
{
    DECLARE_SINGLETON(CStorageAoSvcFactory, CDummyLock)
public:	
    virtual uint32_t getCateId() const;
    virtual int init(void* pvParam = NULL);
    virtual int fini(void* pvParam = NULL);
    virtual void getServiceType(ServiceTypeMap_T& mapSvcType);
    virtual IService* createService(uint32_t dwcmdId);
    
private:
	struct CXYZTimerHandler : public IUserTimerHandler
	{   
		virtual int OnTimer(int iTimerId);
	};
	CXYZTimerHandler m_oTimerHandler;
};

typedef CSingletonT<CStorageAoSvcFactory, CDummyLock> CSvcFactorySingleton;

#endif /* STORAGEAO_ADAPTOR_H */
